package org.example.config;

import org.springframework.integration.annotation.MessagingGateway;
import org.springframework.integration.mqtt.support.MqttHeaders;
import org.springframework.messaging.handler.annotation.Header;

/**
 * MQTT网关
 *
 * @author Brant
 * @since 2025-04-21
 */
@MessagingGateway(defaultRequestChannel = "mqttOutboundChannel")
public interface MqttGateway {
    /**
     * 发送消息到MQTT
     *
     * @param topic   主题
     * @param payload 消息体
     */
    void sendMsgToMqtt(@Header(value = MqttHeaders.TOPIC) String topic, String payload);

    /**
     * 发送消息到MQTT
     *
     * @param topic   主题
     * @param qos     消息质量
     * @param payload 消息体
     */
    void sendMsgToMqtt(@Header(value = MqttHeaders.TOPIC) String topic, @Header(value = MqttHeaders.QOS) int qos, String payload);
}